home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 1997 April to September / Sun Solutions CD - APR '97 - SEP '97 (704-3778-12 Rev. H)(Sun Microsystems, Inc.)(1997).iso / products / .wais / wais_SunSolutions / UPDATE_INDEX < prev    next >
Text File  |  1997-02-28  |  3KB  |  81 lines

  1. #!/bin/sh
  2. #
  3. # little script to index the file tree.  We are using find instead of the
  4. # recursive option to waisindex because the waisindex option doesn't work
  5. # well.
  6. #
  7. # HEY! - this script runs IN the wais data directory
  8.  
  9. ########################################################################
  10. # variables:
  11. #
  12. # INDEX_NAME - the name of the index database.  it should match the name
  13. #              in the /cgi-bin/newwais.pl file ($src).
  14. # HTTP_SERVER - server hostname
  15. # DOCROOT     - root directory that httpd is serving out of.
  16. # DIRECTORIES - list of all the directories to index
  17. #
  18. #
  19. # NOTE: just changing the variable is not enough.  you must change all the
  20. #       pathnames in the file to your installation specifics.
  21.  
  22. INDEX_NAME=/tmp/httpd/.wais/wais_SunSolutions/wais_SunSolutions
  23. HTTP_SERVER=localhost:7999
  24. DOCROOT="/tmp/httpd/.products"
  25.  
  26. #INDEX_NAME="/opt/db/wais/catalyst_catalog"
  27. #HTTP_SERVER="pinatubo"
  28. #DOCROOT="$CD_MOUNT/var/opt/WWW/NCSA/htdocs/CCx86-sparc"
  29. #DOCROOT="/opt/db/wais-src"
  30.  
  31.  
  32. ########################################################################
  33. # get rid of the temporary index file.  if a synonym file does not exist
  34. # create a dummy one.
  35. #
  36. # Shouldn't need to worry about this section
  37. #
  38.  
  39. rm -f $INDEX_NAME.*idxable
  40.  
  41. if [ ! -f $INDEX_NAME.syn ]
  42. then
  43.     echo "# synonym file.  form is:" > $INDEX_NAME.syn
  44.     echo "# word syn0 syn1 ..." >> $INDEX_NAME.syn
  45.     echo "# e.g." >> $INDEX_NAME.syn
  46.     echo "# spam pork-shoulder yummy" >> $INDEX_NAME.syn
  47.     echo "dummy dummy" >> $INDEX_NAME.syn
  48. fi
  49.  
  50. ########################################################################
  51. # use find to add the filenames to a temp file.  if you add more file
  52. # types (e.g. .gif is a file type)
  53. # you'll probably want to update /cgi-bin/newwais.pl in your httpd
  54. # httpd directory so the search result is pretty
  55.  
  56.    find $DOCROOT -follow -name "*.html" -print | egrep -v .wais | egrep -v .bin | egrep -v .categories | egrep -v SunSolutions >> $INDEX_NAME.idxable ;  
  57.    find $DOCROOT -follow -name "*.ps" -print | egrep -v .wais | egrep -v .bin | egrep -v .categories | egrep -v SunSolutions >> $INDEX_NAME.idxable ;  
  58.    find $DOCROOT -follow -name "*.eps" -print | egrep -v .wais | egrep -v .bin | egrep -v .categories | egrep -v SunSolutions >> $INDEX_NAME.idxable ;  
  59.    find $DOCROOT -follow -name "*.txt" -print | egrep -v .wais | egrep -v .bin | egrep -v .categories | egrep -v SunSolutions >> $INDEX_NAME.idxable ;  
  60.    find $DOCROOT -follow -name "*.htm" -print | egrep -v .wais | egrep -v .bin | egrep -v .categories | egrep -v SunSolutions >> $INDEX_NAME.idxable ;  
  61.  
  62.  
  63.  
  64. ########################################################################
  65. # index the files using the temp file as input.  The URL substitution
  66. # is a feature of freeWAIS .202 and up.  it transforms the filename
  67. # into the correct URL so that relative URL's work.  The general
  68. # form is -t URL <what to strip off the front> <what to add to the front>
  69. #
  70. # notes:
  71. #
  72. # * use -a on the subsequent index runs to keep appending to the index file
  73. # * -nocontents tells the indexer to only use the filename...the file
  74. #   contents is ignored
  75.  
  76. ./waisindex -d $INDEX_NAME -export -t URL /tmp/httpd/.products  http://$HTTP_SERVER -stdin < $INDEX_NAME.idxable
  77.  
  78. #./waisindex -a -nocontents -d $INDEX_NAME -export -t URL $CD_MOUNT/var/opt/WWW/NCSA/htdocs  http://$HTTP_SERVER -stdin < $INDEX_NAME.notidxable
  79.  
  80.    
  81.